<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <table>
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
        </tr>
    </table>
    <script>
        var cells = document.getElementsByTagName("th");
        
        for (var i = 0; i < cells.length; i++) {
            cells[i].innerHTML = i + 1; // 从1开始计数
        }
        
        function createTable(i, j) {
            // 创建表格元素
            var table = document.createElement('table');
            
            // 创建行
            for(var h = 1; h <= i; h++) {
               // var tr = document.createElement('tr');
                document.write("<tr>");                // 创建列
                for(var l = 1; l <= j; l++) {
                    //var td = document.createElement('td');
                    document.write("<td>"+"</td>");
                }
                document.write("</tr>"); 
            }
        }
        createTable(4,4);
        function add(i,j){
            var sum=i+j;
            return sum;
        }
        document.write(add(1));
    </script>
</body>
</html>